﻿#include "system_wrappers/interface/rw_lock_wrapper.h"

#include <assert.h>

#if defined(_WIN32)
#include "system_wrappers/source/rw_lock_generic.h"
#include "system_wrappers/source/rw_lock_win.h"
#else
#include "system_wrappers/source/rw_lock_posix.h"
#endif

namespace gn
{

	RWLockWrapper* RWLockWrapper::CreateRWLock()
	{
#ifdef _WIN32
		// Native implementation is faster, so use that if available.
		RWLockWrapper* lock = RWLockWin::Create();
		if (lock)
		{
			return lock;
		}
		return new RWLockGeneric();
#else
		return RWLockPosix::Create();
#endif
	}

}  // namespace gn
